package spacecraft;

import java.awt.Color;
import java.awt.FontMetrics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.event.KeyEvent;

import markgame2d.engine.MarkScreen;

public class BeginScreen extends MarkScreen {

	SpaceCraft game;
	
	public BeginScreen() {
		game = SpaceCraft.getInstance();
	}

	public void paint(Graphics2D g) {
		
		g.setColor(Color.WHITE);
		FontMetrics metrics = g.getFontMetrics();
		Rectangle rect = metrics.getStringBounds("SPACE CRAFT", g).getBounds();
		
		g.drawString("SPACE CRAFT",
				game.getWidth() / 2 - rect.width / 2,
				game.getHeight() / 2 - rect.height / 2);

		rect = metrics.getStringBounds("Press any key to begin", g).getBounds();
		g.drawString("Press any key to begin",
				game.getWidth() / 2 - rect.width / 2,
				game.getHeight() / 2 - rect.height / 2 + 100);
	}

	public void keyPressed(KeyEvent e) {
		game.setScreen(game.gameScreen);
		game.gameScreen.reset();
	}
}